<template>
	<div class="g-tit01">
		<h2>{{ title }}</h2>
		<div class="g-select01"
    	v-if="select.length != 0"
		>
			<el-dropdown
	    	@command="selectFuc"
			>
			  <div class="el-dropdown-link">
			    {{ select01 }} <slot></slot> <i class="icon-transfer"></i>
			  </div>
			  <el-dropdown-menu slot="dropdown"
			  >
			    <el-dropdown-item
			    	v-for="(item,index) of select"
			    	:key="index"
			    	:command="item"
			    >{{ item }}</el-dropdown-item>
			  </el-dropdown-menu>
			</el-dropdown>
		</div>
	</div>
</template>

<script>
	export default {
		name: "gTit01",
		data() {
			return {
				select01: this.select.length ? this.select[0] : ""
			}
		},
		props: {
			title: {
				type: String,
				default: function() {
					return '';
				},
				required: true
			},
			select: {
				type: Array,
				default: function() {
					return [];
				},
				required: false
			}
		},
		methods: {
			selectFuc(command){
				this.select01 = command;
				this.$emit('command',command);
			}
		}
	}
</script>
